/**
 * Description:
 * Class Name:subject_1
 * Date:2022/2/14 12:29
 *
 * @author LTisme
 * @version JAVA17
 */
package 疯狂Java讲义.第6章_面向对象_下.课后练习;

abstract class subject_1_vehicle_abstract_class {
    // 车辆都得有个名字
    public String vehicle_name;
    // 车辆都可以跑起来
    public abstract void run();

    public void setVehicle_name(String vehicle_name) {
        this.vehicle_name = vehicle_name;
    }
}

public class subject_1{
    public static void main(String[] args) {
        // 需要派生几个实例，如：拖拉机、卡车、小轿车
        var tractor = new subject_1_vehicle_abstract_class(){
            @Override
            public void run() {
                System.out.println("The tractor is running......");
            }
        };tractor.setVehicle_name("tractor");

        // 演示：
        tractor.run();
    }
}
